.class public Lcom/example/security/library/Speaker;
.super Ljava/lang/Object;
.source "Speaker.java"

# interfaces
.implements Landroid/speech/tts/TextToSpeech$OnInitListener;


# instance fields
.field private _Tts:Landroid/speech/tts/TextToSpeech;

.field private _activity:Landroid/app/Activity;

.field private message:Ljava/lang/String;


# direct methods
.method private constructor <init>(Landroid/app/Activity;Ljava/lang/String;)V
    .locals 1
    .parameter "activity"
    .parameter "message"

    .prologue
    .line 24
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 14
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/example/security/library/Speaker;->_Tts:Landroid/speech/tts/TextToSpeech;

    .line 25
    iput-object p2, p0, Lcom/example/security/library/Speaker;->message:Ljava/lang/String;

    .line 26
    iput-object p1, p0, Lcom/example/security/library/Speaker;->_activity:Landroid/app/Activity;

    .line 27
    new-instance v0, Landroid/speech/tts/TextToSpeech;

    invoke-direct {v0, p1, p0}, Landroid/speech/tts/TextToSpeech;-><init>(Landroid/content/Context;Landroid/speech/tts/TextToSpeech$OnInitListener;)V

    iput-object v0, p0, Lcom/example/security/library/Speaker;->_Tts:Landroid/speech/tts/TextToSpeech;

    .line 28
    return-void
.end method

.method public static lireMessage(Landroid/app/Activity;Ljava/lang/String;)V
    .locals 1
    .parameter "activity"
    .parameter "message"

    .prologue
    .line 65
    new-instance v0, Lcom/example/security/library/Speaker;

    invoke-direct {v0, p0, p1}, Lcom/example/security/library/Speaker;-><init>(Landroid/app/Activity;Ljava/lang/String;)V

    .line 66
    .local v0, speaker:Lcom/example/security/library/Speaker;
    return-void
.end method


# virtual methods
.method public onInit(I)V
    .locals 3
    .parameter "status"

    .prologue
    .line 34
    if-nez p1, :cond_2

    .line 36
    iget-object v1, p0, Lcom/example/security/library/Speaker;->_Tts:Landroid/speech/tts/TextToSpeech;

    sget-object v2, Ljava/util/Locale;->FRANCE:Ljava/util/Locale;

    invoke-virtual {v1, v2}, Landroid/speech/tts/TextToSpeech;->setLanguage(Ljava/util/Locale;)I

    move-result v0

    .line 38
    .local v0, result:I
    const/4 v1, -0x1

    if-eq v0, v1, :cond_0

    .line 40
    const/4 v1, -0x2

    if-ne v0, v1, :cond_1

    .line 42
    :cond_0
    const-string v1, "TTS"

    const-string v2, "Le langage Francais n\'est pas supporte"

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 57
    .end local v0           #result:I
    :goto_0
    return-void

    .line 46
    .restart local v0       #result:I
    :cond_1
    iget-object v1, p0, Lcom/example/security/library/Speaker;->message:Ljava/lang/String;

    invoke-virtual {p0, v1}, Lcom/example/security/library/Speaker;->speech(Ljava/lang/String;)V

    goto :goto_0

    .line 53
    .end local v0           #result:I
    :cond_2
    const-string v1, "TTS"

    const-string v2, "Aucun module TextToSpeach n\'est installe"

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public speech(Ljava/lang/String;)V
    .locals 3
    .parameter "message"

    .prologue
    .line 87
    iput-object p1, p0, Lcom/example/security/library/Speaker;->message:Ljava/lang/String;

    .line 88
    iget-object v0, p0, Lcom/example/security/library/Speaker;->_Tts:Landroid/speech/tts/TextToSpeech;

    const/4 v1, 0x0

    const/4 v2, 0x0

    invoke-virtual {v0, p1, v1, v2}, Landroid/speech/tts/TextToSpeech;->speak(Ljava/lang/String;ILjava/util/HashMap;)I

    .line 92
    return-void
.end method
